﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ImageProccessingPractice
{
    public partial class ImageChange : Form
    {
        String src;
        public ImageChange()
        {
            InitializeComponent();
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="src">Source of the file (Path)</param>
        public ImageChange(String src): this()
        {
            this.src = src;
            this.pictureBox1.Image = Image.FromFile(src);
        }
        /// <summary>
        /// Turn a color image into a GrayScale picture calling the static method Greaying from GraySacler class
        /// </summary>
        /// <param name="sender">object invoking the click request</param>
        /// <param name="e">the event captured</param>
        private void grayScaler_Click(object sender, EventArgs e)
        {
            this.pictureBox2.Image = GraySacler.Graying(this.src);
        }
        /// <summary>
        /// Transposing an image rotating it 90 degrees
        /// </summary>
        /// <param name="sender">object invoking the click request</param>
        /// <param name="e">the event captured</param>
        private void transPose_Click(object sender, EventArgs e)
        {
            this.pictureBox2.Image = GraySacler.Transpose(this.src);
        }
        /// <summary>
        /// Reverting the image matrix so it would turn the other way
        /// </summary>
        /// <param name="sender">object invoking the click request</param>
        /// <param name="e">the event captured</param>
        private void revertBtn_Click(object sender, EventArgs e)
        {
            this.pictureBox2.Image = GraySacler.Revert(this.src);
        }
        /// <summary>
        ///  Flipping the image top to bottom 
        /// </summary>
        /// <param name="sender">object invoking the click request</param>
        /// <param name="e">the event captured</param>
        private void top2Btm_Click(object sender, EventArgs e)
        {
            this.pictureBox2.Image = GraySacler.TopToBottom(this.src);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender">object invoking the click request</param>
        /// <param name="e">the event captured</param>
        private void cutInHalf_Click(object sender, EventArgs e)
        {
            this.pictureBox2.Image = GraySacler.cutInHalf(this.src);
        }

        
    }
}
